const { DataTypes } = require("sequelize");
const sequelize = require("../db");

const User = sequelize.define(
    "User",
    {
        id: {
            type: DataTypes.INTEGER,
            autoIncrement: true, // 自增
            primaryKey: true, // 主键
        },
        name: {
            type: DataTypes.STRING(32), // 将长度设为 32
            allowNull: false,
            unique: true,
        },
        email: {
            type: DataTypes.STRING(32), // 将长度设为 32
            allowNull: false,
            unique: true,
        },
        password: {
            type: DataTypes.STRING,
            allowNull: false,
        },
    },
    {
        timestamps: false, // 禁用自动生成的 createdAt 和 updatedAt
    }
);

module.exports = User;
